<include file="Common:minheader" />
<!-- /. NAV SIDE  -->
<script type="text/javascript" charset="utf-8" src="__UEDITOR__/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__UEDITOR__/ueditor.all.js"></script>
<script type="text/javascript" src="__UEDITOR__/lang/zh-cn/zh-cn.js"></script>
<form class="layui-form" action="">
	<input type="hidden" name="tid" value="{$info.id}">
	<div class="layui-form-item">
		<label class="layui-form-label">开始时间</label>
		<div class="layui-input-block">
			<input type="text" name="leave_start_time" placeholder="请选择请假开始时间" autocomplete="off" class="layui-input" id="addtime_fromdate">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">结束时间</label>
		<div class="layui-input-block">
			<input type="text" name="leave_end_time" placeholder="请选择请假结束时间" autocomplete="off" class="layui-input" id="addtime_fromdate">
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">费用</label>
		<div class="layui-input-inline">
			<input type="text" name="expense" value="0" class="layui-input" lay-verify="required|number" lay-reqtext="市场价不能为空">
		</div>
	</div>
	<div class="layui-form-item layui-form-text" style="z-index: 1;">
		<label class="layui-form-label">备注</label>
		<div class="layui-input-block">
			<textarea name="memo" placeholder="请输入备注" class="layui-textarea"></textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
		  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
		  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
  </div>
</form>
<script>
	//Demo
	layui.use(['form','rate','colorpicker'], function(){
    var rate = layui.rate;
      //基础效果
    rate.render({
          elem: '#rateNums',
          value: 3,
          choose: function(res){
              console.log(res);
              $('#level').val(res);
          }
    })
    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data){
    	var cont = data.field;
    	$.ajax({
    		url:"{:U('Course/leaveCourse')}",
    		type:'post',
    		dataType:'json',
    		data:cont,
    		success:function(data){
    			if(data.code==0){
    				layer.alert(data.message);
    			}else{
    				layer.alert(data.message, function(index){
    					//do something
    					window.parent.location.reload();
    					var index = parent.layer.getFrameIndex(window.name); 
    					parent.layer.close(index);
    				});
    			}
    		}
    	});
    	//layer.msg(JSON.stringify(data.field));
    	return false;
    });
});
</script>
<!-- /. PAGE INNER  -->
<include file="Common:footer" />